import 'package:flutter/material.dart';
import 'package:lai_zhan/common/style/AppStyle.dart';
/**
 * 扩展边框按钮
 */
class FlexOutlineButton extends StatelessWidget {
  final String text;

  final Color color ;

  final Color textColor;

  final Color borderColor ;

  final VoidCallback onPress;

  final double fontSize;

  final double borderWidth;

  final int maxLines;

  final MainAxisAlignment mainAxisAlignment;

  FlexOutlineButton(
      {Key key,
        this.text,
        this.color = Colors.black,
        this.textColor,
        this.onPress,
        this.fontSize = 20.0,
        this.mainAxisAlignment = MainAxisAlignment.center,
        this.maxLines = 1,
        this.borderColor = Colors.black,
        this.borderWidth =1,})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return new OutlineButton(
      borderSide: BorderSide(color: borderColor,width: borderWidth,),
        padding: new EdgeInsets.only(
            left: 20.0, top: 10.0, right: 20.0, bottom: 10.0),
        textColor: textColor,
        color: color,
        child: new Flex(
            mainAxisAlignment: mainAxisAlignment,
            direction: Axis.horizontal,
            children: <Widget>[
              new Container(
                child: new Text(text,
                    style: new TextStyle(fontSize: fontSize),
                    maxLines: maxLines,
                    overflow: TextOverflow.ellipsis),
              )
            ]),
        onPressed: () {
          this.onPress?.call();
        });
  }
}
